package com.magist.core.entity;
/**
 * 前后端通讯对象
 * @author zja
 *
 */
public class ResultMessage {
	private boolean success;
	private String message;		//返回的提示信息
	private Object content;		//返回的内容信息 可以是任何信息取决于业务，
	private String code;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getContent() {
		return content;
	}
	public void setContent(Object content) {
		this.content = content;
	}
	public static ResultMessage success() {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage("操作成功!");
		return result;
	}
	public static ResultMessage success(String message) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage(message);
		
		return result;
	}
	public static ResultMessage success(String message,String content) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage(message);
		result.setContent(content);
		return result;
	}
	public static ResultMessage error() {
		ResultMessage result = new ResultMessage();
		result.setSuccess(false);
		result.setMessage("操作失败!");
		return result;
	}
	public static ResultMessage error(String message) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(false);
		result.setMessage(message);
		return result;
	}
	public static ResultMessage error(String message,String content) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(false);
		result.setMessage(message);
		result.setContent(content);
		return result;
	}
	
	
	public static ResultMessage info() {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage("提示信息!");
		return result;
	}
	public static ResultMessage info(String message) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage(message);
		
		return result;
	}
	public static ResultMessage info(String message,String content) {
		ResultMessage result = new ResultMessage();
		result.setSuccess(true);
		result.setMessage(message);
		result.setContent(content);
		return result;
	}
	
}
